#include <cstdio>

using namespace std;

const int maxn=100000, maxm=200000;

int n, m, ind[maxn+1], deg[maxn+1], to[2*maxm+1], link[2*maxm+1];

void initGraph() {
    m=0;
    for (int i=1; i<=n; i++) ind[i]=deg[i]=0;
}

void addSide(int u, int v) {
    m++;
    to[m] = v;
    link[m] = ind[u];
    ind[u] = m;
    deg[v]++;
}

int getFa(int fa[], int o) {
    return fa[o]==o ? o : fa[o]=getFa(fa, fa[o]);
}

bool check(int o) {
    int set[maxn+1];
    for (int i=1; i<=n; i++) set[i] = i;

    for (int i=1; i<=n; i++) {
        if (i!=o) {
            for (int j=ind[i]; j; j=link[j]) {
                if (to[j]>i && to[j]!=o) {
                    if (getFa(set, i)==getFa(set, to[j])) return false;
                    else set[getFa(set, i)] = getFa(set, to[j]);
                }
            }
        }
    }
    return true;
}

int main() {
    freopen("walk.in", "r", stdin);
    freopen("walk.out", "w", stdout);

    int t;
    scanf("%d", &t);
    for (; t; t--) {
        int m;
        scanf("%d %d", &n, &m);
        initGraph();
        for (int i=1; i<=m; i++) {
            int u, v;
            scanf("%d %d", &u, &v);
            addSide(u, v);
            addSide(v, u);
        }

        bool flag=true;
        int t1=0, t2=0;
        for (int i=1; i<=n && flag; i++) {
            if (deg[i]%2) {
                if (!t1) t1=i;
                else if (!t2) t2=i;
                else flag=false;
            }
        }
        if (t1 && !t2) flag=false;

        if (flag) {
            if (t1) flag = check(t1) || check(t2);
            else {
                int mx=1;
                for (int i=1; i<=n; i++) {
                    if (deg[i]>deg[mx]) mx=i;
                }
                flag = check(mx);
            }
        }
        printf(flag ? "YES\n" : "NO\n");
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}
